import apiMixin from '@/mixin/apiMixin';
import taskMixin from '@/mixin/taskMixin';
export default {
    mixins: [apiMixin,taskMixin],
    data() {
      return {
        tableData: [],
        listNumsTotal: 0,
        searchText: '',
        loading: false,
        curPage: 1
      }
    },
    mounted() {
      this.init();
    },
    methods: {
      init() {
        this.getSystemTeplateListApi();
      },
      getSystemTeplateListApi(page) {
        let _self = this;
        this.comResquest(this.request.getSystemTeplateList,(res)=>{
            console.log(res);
            _self.curPage = Number(page) || 1;
            _self.updateRoutePar(page);
            let { count,result } = res;
            _self.listNumsTotal = count;
            _self.tableData = result;
        },{
          page,
          keyword: this.searchText,
          load: true
        })
      },
      changePage(page) {
        this.getSystemTeplateListApi(page || 1);
      },
      searchWill() {
        this.getSystemTeplateListApi();
      },
      deleteWayType(delIndex) {
        let curSystemPlate = this.tableData[delIndex];
        this.deleteSystemTemplateApi(curSystemPlate.id);
      },
      deleteSystemTemplateApi(id) {
        let _self = this;
        this.comResquest(this.request.deleteSystemTemplate,(res)=>{
            console.log(res);
            _self.init();
            _self.$message.success("删除成功");
        },{
          id: id,
          load: true
        });
      }
    },
  }